<%--
  Created by IntelliJ IDEA.
  User: cos
  Date: 2022/6/1
  Time: 14:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fm" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<script>
    $(function () {
        $(".del").click(function () {
            if (confirm("确认删除")) {
                //获取的主键数据
                var eno = $(this).parents("tr").children().first().text();
                location.href="/emp?method=delEmp&eno="+eno;
            }
        })
    })


</script>

<h1>index</h1>
<a href="addEmp.jsp">新增员工数据</a>
<table border="1">
    <thead>
    <tr>
        <td>员工编号</td>
        <td>员工姓名</td>
        <td>员工性别</td>
        <td>员工工资</td>
        <td>员工密码</td>
        <td>员工出生日期</td>
        <td>员工部门编号</td>
        <td>操作 </td>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${pi.list}" var="e">
        <tr>
            <td>${e.eno}</td>
            <td>${e.ename}</td>
            <td>${e.esex}</td>
            <td>${e.salary}</td>
            <td>${e.pwd}</td>
            <td><fm:formatDate value="${e.bornDate}" pattern="yyyy-MM-dd"/> </td>
            <td>${e.dno}</td>
            <td>
                <a href="#">修改</a>
                <button class="del">删除</button>
            </td>
        </tr>
    </c:forEach>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="8">
            <a href="/emp?method=getEmpByPages&pageIndex=1">首页</a>
            <a href="/emp?method=getEmpByPages&pageIndex=${pi.prePage}">上一页</a>
            <a href="/emp?method=getEmpByPages&pageIndex=${pi.nextPage}">下一页</a>
            <a href="/emp?method=getEmpByPages&pageIndex=${pi.pages}">尾页</a>
            ${pi.pageNum}/${pi.pages}
        </td>
    </tr>
    </tfoot>
</table>
</body>
</html>
